var express = require("express");
var router = express.Router();
var user = require("../controllers/userController");

let multer = require("multer");
let upload = multer({ dest: "./public/uploads/" }).single("file");
let moreUpload = multer({ dest: "./public/uploads/" }).array("file", 6);

// 模拟发送验证码
router.post("/sendCode", user.sendCode);
// 验证码登录
router.post("/codePhoneLogin", user.codePhoneLogin);
// 登陆
router.post("/login", user.login);
// 修改用户资料
router.post("/editUserInfo", user.editUserInfo);
// 修改密码
router.post("/setPassword", user.setPassword);
// 绑定邮箱
router.post("/bindEmail", user.bindEmail);
// 修改用户默认头像
router.post("/editUserImage", upload, user.editUserImage);
// 批量上传
router.post("/uploadMoreImg", moreUpload, user.uploadMoreImg);
// 发布视频
router.post("/publlish", user.publlish);
// 退出登陆
router.post("/logout", user.logout);

module.exports = router;
